Ext.define("wmf.view.access.edit", {
    extend: "wmf.lib.FormPanel",
    alias: "widget.accessEdit",
	anchor: '100% 100%',
    border: false,
    autoScroll: true,
    fieldDefaults: {
        labelWidth: 90
    },
    items: [{
    	xtype: "hidden",
        name: "id"
    },{
    	xtype: "textfield",
        name: "ecName", 
        editable: false,
        readOnly: true,
        fieldLabel: "企业名称"
    },{
    	xtype: "textfield",
        name: "ecId", 
        editable: false,
        readOnly: true,
        fieldLabel: "企业Id"
    },{
    	xtype: 'combo',
 		emptyText:  '请选择...',
 		hiddenName: 'channelType',
 		autoSelect: true,
 		displayField: 'name',
 		queryMode: 'local',
 		valueField: 'channelType',
 		allowBlank: false,
 		triggerAction: 'all',
 		editable: false,
 		readOnly: true,
 		store: 'channel.channelType',
        name: "linkType",
        fieldLabel: "接入类型"
    },{
    	xtype: 'combo',
		emptyText:  '请选择...',
		hiddenName: 'protocalType',
		autoSelect: true,
		displayField: 'name',
		queryMode: 'local',
		valueField: 'protocalType',
		triggerAction: 'all',
		allowBlank: false,
		editable: false,
        readOnly: true,
		store: 'access.protocalType',
        name: "protocalType", 
        fieldLabel: "协议类型"
    },{
        xtype: "textfield",
        name: "ipInfo", 
        fieldLabel: "IP信息"
    },{
        xtype: "textfield",
        name: "flowControl", 
        vtype: 'numbers',
        fieldLabel: "流量控制"
    },{
    	xtype: 'combo',
		emptyText:  '请选择...',
		hiddenName: 'className',
		autoSelect: true,
		displayField: 'capFlowName',
		queryMode: 'remote',
		valueField: 'className',
		triggerAction: 'all',
		editable: false,
		minChars: 0,
 		forceSelection : true,
 		selectOnFocus : true,
        listeners : {
        	'beforequery': function(qe){
        		delete qe.combo.lastQuery;
        	}, 
        	'expand': function(combo, eOpts){
        		combo.store.clearFilter();
	    	    combo.store.filter({
	        		property     : 'classType',
	        		value        : '3',
	        		anyMatch     : true, //optional, defaults to true
	        		caseSensitive: false  //optional, defaults to true
	        	});  
	    	    combo.store.filter({
	        		property     : 'businessType',
	        		value        : combo.up('panel').getForm().getValues().linkType,
	        		anyMatch     : true, //optional, defaults to true
	        		caseSensitive: false  //optional, defaults to true
	        	});
	    	    combo.onLoad();
 			}
 		},
		store: 'channel.classUsage3',
        name: "capFlowName", 
        fieldLabel: "流控能力接口"
    },{
        xtype: "textarea",
        name: "capBusiness", 
        vtype: 'capMax',
        fieldLabel: "接入业务参数"
    },{
        xtype: "textarea",
        name: "capReverse", 
        fieldLabel: "上行路由参数"
    },{
    	xtype: 'combo',
		emptyText:  '请选择...',
		hiddenName: 'className',
		autoSelect: true,
		displayField: 'capReverseName',
		queryMode: 'remote',
		valueField: 'className',
		triggerAction: 'all',
		editable: false,
		minChars: 0,
 		forceSelection : true,
 		selectOnFocus : true,
        listeners : {
        	'beforequery': function(qe){
        		delete qe.combo.lastQuery;
        	}, 
        	'expand': function(combo, eOpts){
        		combo.store.clearFilter();
	    	    combo.store.filter({
	        		property     : 'classType',
	        		value        : '4',
	        		anyMatch     : true, //optional, defaults to true
	        		caseSensitive: false  //optional, defaults to true
	        	});  
	    	    combo.store.filter({
	        		property     : 'businessType',
	        		value        : combo.up('panel').getForm().getValues().linkType,
	        		anyMatch     : true, //optional, defaults to true
	        		caseSensitive: false  //optional, defaults to true
	        	});
	    	    combo.onLoad();
 			}
 		},
		store: 'channel.classUsage',
        name: "capReverseName", 
        fieldLabel: "上行路由能力接口"
    },{
    	xtype: 'combo',
		emptyText:  '请选择...',
		hiddenName: 'className',
		autoSelect: true,
		displayField: 'capAClass',
		queryMode: 'remote',
		valueField: 'className',
		triggerAction: 'all',
		editable: false,
		minChars: 0,
 		forceSelection : true,
 		selectOnFocus : true,
 		listeners : {
 			'beforequery': function(qe){
        		delete qe.combo.lastQuery;
        	}, 
        	'expand': function(combo, eOpts){
        		combo.store.clearFilter();
	    	    combo.store.filter({
	        		property     : 'classType',
	        		value        : '1',
	        		anyMatch     : true, //optional, defaults to true
	        		caseSensitive: false  //optional, defaults to true
	        	});  
    	    	combo.store.filter({
	        		property     : 'businessType',
	        		value        : combo.up('panel').getForm().getValues().linkType,
	        		anyMatch     : true, //optional, defaults to true
	        		caseSensitive: false  //optional, defaults to true
	        	});
	    	    combo.onLoad();
 			}
 		},
		store: 'channel.classUsage2',
        name: "capAClass", 
        fieldLabel: "接入模块"
    }],
    
	dockedItems: [{
		xtype: 'toolbar',
		dock: 'bottom',
		layout: {
				type: 'hbox',
				alian: 'center',
				flex: 1
		},
		
		defaults: {
				xtype: 'button'
		},
		items: [{
			xtype : 'tbfill'
		},{
			itemId: 'save',
			icon: 'resources/icons/pencil.png',
			formBind: true,
			text: translations.global.operation.edit
		},{
			itemId: 'reset',
			icon: 'resources/icons/icon_recover.png',
			text: translations.global.operation.reset
		},{
			itemId: 'cancel',
			icon : 'resources/icons/icon_revoke.png',
			text: translations.global.operation.cancel
		}]
	}]
});